package com.nnnu.orange.controller.user;


import com.nnnu.orange.constant.MessageConstants;
import com.nnnu.orange.result.Result;
import com.nnnu.orange.service.IPaymentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 支付记录表，记录用户支付的罚款信息 前端控制器
 * </p>
 *
 * @author zk
 * @since 2024-12-08
 */
@RestController("userPaymentsController")
@RequestMapping("/user/payments")
@RequiredArgsConstructor
@Api(tags = "用户端订单相关接口")
@Slf4j
public class PaymentsController {

    private final IPaymentsService paymentsService;

    /**
     * 用户支付逾期订单
     *
     * @param orderId 订单ID
     * @return 提示
     */
    @PostMapping("/pay")
    @ApiOperation("用户支付逾期订单")
    public Result<?> payFine(@RequestBody Integer orderId) {
        log.info("用户支付逾期订单:{}", orderId);
        paymentsService.payFine(orderId);
        return Result.success(MessageConstants.PAY_OK);
    }

}
